package cate.game.activity.destinygate.msg;

import cate.common.util.GameResult;
import cate.game.GameBody;
import cate.game.activity.destinygate.DestinyGateActivity;
import cate.game.client.ClientContext;
import cate.game.client.msg.ClientMsg;
import cate.game.client.msg.MsgConfig;
import cate.game.client.msg.MsgInput;
import cate.game.client.msg.id.MsgIdBDestinyGate;
import easy.java.dev.note.NoteField;

@ClientMsg(title = "命运之扉选择自选英雄 の 请求")
public class ChooseHeroReq implements MsgInput {
    @NoteField("功能id")
    public int funcId;
    @NoteField("英雄id")
    public int heroId;
    @NoteField("位置（左1 右2）")
    public int pos;

    @Override
    public MsgConfig conf() {
        return MsgIdBDestinyGate.CHOOSE_HERO_REQ;
    }

    @Override
    public void execute(GameBody game, ClientContext cc) {
        DestinyGateActivity single = cc.getRole().getActivity().getEnableActivitySingle(funcId);
        if (single == null) {
            cc.getRole().getGame().notice.message(cc.getRole(), "活动未开启");
            return;
        }
        GameResult<DestinyGateActivity> result = single.chooseHero(heroId, pos);
        if (!result.ok()) {
            game.notice.message(cc.getRole(), result.message);
        }
    }
}
